package com.atguigu.springboot.Aware;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanNameAware;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;

@Component
public class ApplicationContextAwareDemo   implements ApplicationContextAware, BeanNameAware, InitializingBean, DisposableBean{
    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        System.out.println("ApplicationContextAware执行setApplicationContext");
    }

    @Override
    public void setBeanName(String s) {
        {
            System.out.println("BeanNameAware执行setBeanName");
    }
}


    @Override
    public void destroy() throws Exception {
        System.out.println("DisposableBean执行destroy");
    }

    @Override
    public void afterPropertiesSet() throws Exception {
        System.out.println("InitializingBean执行afterPropertiesSet");
    }


}
